<?
include "./Lib/DBMySql.inc";
include "./Lib/Common.php";
include "./Entities/menuObj.php";
include "./DAL/menuDAL.php";
include "./Entities/menurightsObj.php";
include "./DAL/menurightsDAL.php";

$mainDB = NewDB(DATABASE_HOST, DATABASE_NAME , DATABASE_USER, DATABASE_PASSWORD);

$menus = menuDAL::GetList($mainDB, "", "", "", $errorMsg);
for ($i=0; $i<count($menus); $i++) {
	$menu = $menus[$i];
	$menuRights = menurightsDAL::GetList($mainDB, "MenuID=".$menu->id, "OrderNum ASC", "", $errorMsg);
	for ($j=0; $j<count($menuRights); $j++) {
		$menuRight = $menuRights[$j];
		echo "function ".$menu->nombre."_".$menuRight->Code."() <br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;global \$userRightsObj;<br>&nbsp;&nbsp;&nbsp;&nbsp;return \$userRightsObj['".$menu->nombre."']['".$menuRight->Code."'];<br>}<br>";
	}
}
include "userRight.php";
$userRightsObj['Dashboard']['MsStatus'] = true;
if (Dashboard_MsStatus()) echo "Has right";
else echo "No right";
?>